At 4:47 PM -0300 2/20/2002, Jon Lapham wrote:
>Hello folks-
>
>Does anyone have a suggestion on how to order a varchar(2) column
>containing values like: 'A', 'B', ..., 'Z', 'AA', 'AB', ...
>
>What I would like to to return the tuples in this order:
>A
>B
>C
>...
>X
>Y
>Z
>AA
>AB
>...
In transact-sql, I've used a structure something like:
ORDER BY
CASE WHEN TABLE.MYCOLUMN LIKE '__'
THEN TABLE.MYCOLUMN
ELSE ' ' || TABLE.MYCOLUMN END
The syntax may be a little different in pg, though.
It's also easy enough to do in Perl with a custom sort sub.
-Charles
--
Charles Albrecht Euonymic Solutions
charlesa@pobox.com P.O. Box 300623
C>303.619.7596 F>978.334.3061 Denver, Colorado 80203-0623
http://www.euonymic.net/~charlesa/cv/